package com.robot.member.dao;

import com.robot.member.pojo.Evaluate;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.robot.member.pojo.Complaint;

/**
 * complaint数据访问接口
 *
 * @author wuyunbin
 */
public interface ComplaintDao extends JpaRepository<Complaint, String>, JpaSpecificationExecutor<Complaint> {
    /**
     * 根据memberID查找会员名下所有投诉并分页
     *
     * @param memberId
     * @param pageable
     * @return
     */
    public Page<Complaint> findAllByMemberIdAndDeletedAtIsNullOrderByCreatedAtDesc(String memberId, Pageable pageable);

    /**
     * 根据memberID和status查找会员名下所有投诉并分页
     *
     * @param memberId
     * @param status
     * @param pageable
     * @return
     */
    public Page<Complaint> findAllByMemberIdAndStatusAndDeletedAtIsNullOrderByCreatedAtDesc(String memberId, String status, Pageable pageable);

    /**
     * 根据id和memberID查找会员名下某一投诉
     *
     * @param id
     * @param memberId
     * @return
     */
    public Complaint findByIdAndMemberId(String id, String memberId);
}
